(function() {
  app.service('global_m', function(bottomdilog, $rootScope, $window, header_m, $state, toast, footer_m, centerdilog) {
    this.state_change = function(obj, from) {

      // 头部的初始化
      header_m
        .reset();

      header_m.set({
        title_c: obj.title,
        current_state: obj.url
      });

      // 底部的随路由的变化
      footer_m
        .change(obj.url);

      // 刷新功能的实现
      $('#header_right')
        .removeClass('reload-ate');

      centerdilog
        .view = false;
      bottomdilog
        .view = false;

      toast.show(obj.url);
      $rootScope.current_state = obj.url; // 当前路由的标识

    };
  });
})(angular);